<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8" />
<title>财务管理 - 提现列表</title>
<?php include($this->c['_homes']['_viewsHome'].'/_global/_head.php');?>
</head>
<!-- BEGIN BODY -->
<body class="page-header-fixed page-sidebar-fixed">
<!-- BEGIN HEADER -->
<?php include($this->c['_homes']['_viewsHome'].'/_global/head.php');?>
<!-- END HEADER -->
<div class="clearfix"></div>
<!-- BEGIN CONTAINER -->
<div class="page-container" > 
  <!-- BEGIN HORIZONTAL MENU PAGE SIDEBAR1 -->
  <?php include($this->c['_homes']['_viewsHome'].'/_global/menu.php');?>
  <!-- END BEGIN HORIZONTAL MENU PAGE SIDEBAR --> 
  <!-- BEGIN PAGE -->
  <div class="page-content">   	 
    <!-- BEGIN PAGE HEADER-->
    <div class="row">
      <div class="col-md-12"> 
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title"> 提现列表 </h3>
        <ul class="page-breadcrumb breadcrumb">        	
          <li> <i class="icon-home"></i> <a href="/manage">后台</a> <i class="icon-angle-right"></i> </li>
          <li> 财务管理 <i class="icon-angle-right"></i> </li>
          <li>提现列表</li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB--> 
      </div>
    </div>
    <!-- END PAGE HEADER--> 
    <!-- BEGIN PAGE CONTENT-->
    <div class="row">
      <div class="col-md-12">
        <div class="portlet box">
          <div class="booking-search">
            <form action="" role="form" method="get" id="forms">
              <div class="row form-group">              
                <div class="col-md-4">                  
                  <div class="input-cont">
                    <input class="form-control" name="keyword" placeholder="收款人姓名/ID/手机号码" value="<?=$_GET['keyword'];?>" type="text">
                  </div>
                </div>
               <div class="col-md-2">                  
                  <div class="input-cont">
                    <input class="form-control" name="money" placeholder="请输入提现金额" value="<?=$_GET['money'];?>" type="text">
                  </div>
                </div>
                <div class="col-md-2">                  
                  <select class="form-control" name="status">
                    <option value="">状态</option>
                    <?php
          					if($this->c['stat']['withdraw_stat']){
          						foreach($this->c['stat']['withdraw_stat'] as $k=> $r){
          							if(isset($this->data['para']['status']) && $k==$this->data['para']['status']) $slk = ' selected';
          							else $slk = '';
          					?>
                    <option value="<?=$k;?>"<?=$slk;?>><?=$r;?></option>
                    <?
          						}
          					}
          					?>
                 </select>
                </div>  
               <div class="col-md-2">                  
                  <select class="form-control" name="withdraw_type">
                    <option value="">类型</option>
                    <?php
          					if($this->c['stat']['withdraw_type']){
          						foreach($this->c['stat']['withdraw_type'] as $k=> $r){
          							if(isset($this->data['para']['withdraw_type']) && $k==$this->data['para']['withdraw_type']) $slk = ' selected';
          							else $slk = '';
          					?>
                    <option value="<?=$k;?>"<?=$slk;?>><?=$r;?></option>
                    <?
          						}
          					}
          					?>
                 </select>
                </div>
                <div class="col-md-2">                  
                  <select class="form-control" name="coin_type">
                    <option value="">币种 </option>
                    <?php
                    if($this->c['stat']['coin_type']){
                      foreach($this->c['stat']['coin_type'] as $k=> $r){
                        if(isset($this->data['para']['coin_type']) && $k==$this->data['para']['coin_type']) $slk = ' selected';
                        else $slk = '';
                    ?>
                    <option value="<?=$k;?>"<?=$slk;?>><?=$r;?></option>
                    <?
                      }
                    }
                    ?>
                 </select>
                </div> 
                </div>
                <div class="row form-group">
                <div class="col-md-1"><input type="submit" class="btn blue btn-block" value="搜 索"></div>
               <!--  <div class="col-md-2"><input type="button" class="btn blue btn-block" value="导出等待处理申请" onclick="_goto_export();"></div>-->
                    <div class="col-md-1"><input type="button" class="btn blue btn-block" value="导出" onclick="_export();"></div>
                    <div class="col-md-1"><input type="button" class="btn blue btn-block" value="统计" onclick="_statistics();"></div>  
              </div>
              
            </form>
          </div>
        </div>
      </div>
    </div> 
      <div class="row form-group statistics" style="float:right;color:red;display:none;"> 
      <span id="_total_money"></span>
      </div>     
    <div class="row">
      <div class="col-md-12"> 
        <!-- BEGIN SAMPLE TABLE PORTLET-->                  
        <div class="portlet box blue">
          <div class="portlet-title">
            <div class="caption"><i class="icon-list"></i>列表(<?=$this->data['count'];?>)</div>
            <div class="tools"> <a href="javascript:;" class="collapse"></a> </div>
          </div>
          <div class="portlet-body">
            <div class="table-scrollable">
             <table class="table table-striped table-bordered table-hover dataTable">
              <thead>
                <tr>
                  <th>流水号</th>
                  <th>头像</th>
                  <th>昵称</th>
                  <th>申请时间</th>
                  <th>金额</th>
                  <th>收款人</th>
                  <th>收款人电话</th>
                  <th>状态</th>
                  <th>类型</th>
                  <th>币种</th>
                  <th>操作</th>
                </tr>
              </thead>
 <tbody>
              <?php
			if($this->data['data'])
			{
				foreach($this->data['data'] as $k=> $r){												
			?>
                <tr>
                  <td><?=$r['id'];?></td>
                  <td><?php
                  $headimgurl = '/style/assets/img/avatar.png';
                  if($r['headimgurl'])
                  {
                      $headimgurl = $r['headimgurl'];
                  }
                  elseif($r['wechat_headimgurl'])
                  {
                      $headimgurl = $r['wechat_headimgurl'];
                  }
                  ?><img src="<?=$headimgurl;?>" width="45" height="45" />                                            
                  </td>
                  <td>[<?=$r['uid'];?>]<?=$r['user_name']?></td>
                  <td><?=date("Y-m-d H:i",$r['create_time']);?></td>
                  <td><?=$r['money'];?></td>
                  <td><?=$r['realname'];?></td>  
                  <td><?php if($r['mobile']){echo $r['mobile'];}else{echo '--';}?></td>                 
                  <td><?=$this->c['stat']['withdraw'][$r['stat']];?></td> 
                  <td><?=$this->c['stat']['withdraw_type'][$r['withdraw_type']];?></td>
                  <td><?=$this->c['stat']['coin_type'][$r['coin_type']];?></td>                                       
                  <td>
				          <a href="withdraw_detail?id=<?=$r['id'];?>" class="btn btn-xs blue"><i class="icon-eye-open"></i> 查看</a>
                 <!--   <a href="/member/finance_detail?uid=<?=$r['uid'];?>" class="btn btn-xs blue"><i class="icon-eye-open"></i> 收支明细</a>-->
                  </td>
                </tr>
                <?
					}
				}
				?>
				 </tbody>                                
            </table>
            </div>
          </div>
        </div>
        <?php
		if($this->data['maxpage'] > 1){
		?>
        <div>
          <ul class="pagination">
            <?
			$pquery="?";		
			if($this->data['para']){			
				foreach($this->data['para'] as $k=>$r){				
					$pquery.=$k."=".$r."&";
				}			
			}
			
			if($this->data['page'] > 1) echo '<li><a href="'.$pquery.'page='.($this->data['page']-1).'"><i class="icon-angle-left"></i></a></li>';
			for($i = $this->data['spage']['ps']; $i<=$this->data['spage']['pe']; $i++){
			if($i == $this->data['page']) echo '<li class="disabled"><a href="javascript:void(0);">'.$i.'</a></li>';
			else echo '<li><a href="'.$pquery.'page='.$i.'">'.$i.'</a></li>';
			}
			
			if($this->data['page'] < $this->data['maxpage']) echo '<li><a href="'.$pquery.'page='.($this->data['page']+1).'"><i class="icon-angle-right"></i></a></li>';
			?>
          </ul>
        </div>
        <?
 		}
?>
        <!-- END SAMPLE TABLE PORTLET--> 
      </div>
    </div>
    <!-- END PAGE CONTENT--> 
  </div>
  <!-- END PAGE --> 
</div>
<!-- END CONTAINER -->
<?php include($this->c['_homes']['_viewsHome'].'/_global/_footer.php');?>
<script>
var _submit_action = '',_uid = 0;
jQuery(document).ready(function() {    
	App.init();	
});
function _goto_export(){
	window.location.href = 'withdraw_export';
}

function _export(){
	 var obj = $('#forms').serialize();
	 window.open("withdraw_all_export?"+obj);
	
}

function _statistics(){

     $.ajax({
     type: "POST",
     url: "withdraw_ajax",
     data:$("#forms").serialize()+"&act=ajax_statistics",
     dataType: "json",
     success: function(data) {
       if(data > 0){
    	   $('.statistics').show();
    	   $('#_total_money').html('统计：'+data);
         }else{

        	 $('.statistics').hide();
         }

    
     }
    }); 
}
</script> 
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>